﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Nebular.ExpenseManagement.WebApplication
{
    static class PaginationExtensions
    {
        
        const int DefaultItemsOnPage = 20;
        public static IEnumerable<T> AsPagination<T>(this IEnumerable<T> coll, int page, int itemsOnPage)
        {
            
            return coll.Skip(itemsOnPage * (page - 1)).Take(itemsOnPage);
        }
        public static IEnumerable<T> AsPagination<T>(this IEnumerable<T> coll, int page)
        {
            return coll.AsPagination(page, DefaultItemsOnPage);
        }
    }
}
